begintownscript;

variables;
short bmessage,pcs,seated,leadchar,rctx,rcty;
string custom_m;

body;

beginstate INIT_STATE;
	turn_off_training(1);

	leadchar = 0;
	while(char_ok(leadchar) == FALSE){
		leadchar = (leadchar + 1);
	}
	pcs = leadchar;
	seated = 0;
	while(pcs <= 3){
		if(char_ok(pcs) == TRUE){
			if(seated == 0){
				relocate_character(pcs,18,18);
				set_character_facing(pcs,2);
			}
			if(seated == 1){
				relocate_character(pcs,15,20);
				set_character_facing(pcs,0);
			}
			if(seated == 2){
				relocate_character(pcs,17,14);
				set_character_facing(pcs,2);
			}
			if(seated == 3){
				relocate_character(pcs,17,21);
				set_character_facing(pcs,0);
			}

			seated = (seated + 1);
		}

		pcs = (pcs + 1);
	}
	set_character_pose(1000,14);
	force_view_center(18,18);
	force_instant_terrain_redraw();
	pause(8);

	pcs = leadchar;
	while(pcs <= 3){
		if(char_ok(pcs) == TRUE){
			set_character_pose(pcs,0);
			force_instant_terrain_redraw();
			pause(6);
		}

		pcs = (pcs + 1);
	}

	reset_dialog();
	add_dialog_str(0,"_Hello.  I see you've awoken._",0);
	add_dialog_choice(0,"The Immortal...!");
	bmessage = run_dialog(0);

	reset_dialog();
	add_dialog_str(0,"_Did you sleep well?_",0);
	if(party_size() == 1)
		add_dialog_choice(0,"Where am I?");
	if(party_size() > 1)
		add_dialog_choice(0,"Where are we?");
	add_dialog_choice(1,"Yes.");
	add_dialog_choice(2,"Die! (Attack)");
	bmessage = run_dialog(0);

	if(bmessage == 3){
		set_character_pose(1000,2);
		force_instant_terrain_redraw();
		play_sound(18);
		pause(5);

		set_character_pose(6,1);
		force_instant_terrain_redraw();
		play_sound(19);
		pause(5);
		set_character_pose(6,0);
		force_instant_terrain_redraw();
		pause(2);

		reset_dialog();
		if(party_size() == 1){
			add_dialog_str(0,"_Put your weapon down, fool.  You have no clue where you are, and if I die here, then you are lost, are you not?_",0);
			add_dialog_str(1,"...he has a point.  Looks like my hands are tied.",0);
		}
		if(party_size() > 1){
			add_dialog_str(0,"_Put your weapons down, fools.  You have no clue where you are, and if I die here, then you are lost, are you not?_",0);
			add_dialog_str(1,"...he has a point.  Looks like our hands are tied.",0);
		}
		add_dialog_choice(0,"(Reluctantly Disarm)");
		bmessage = run_dialog(0);

		set_character_pose(1000,0);
		force_instant_terrain_redraw();
		play_sound(93);
		pause(5);

		reset_dialog();
		add_dialog_str(0,"_Now, what were you about to say?_",0);
		if(party_size() == 1)
			add_dialog_choice(0,"Where am I?");
		if(party_size() > 1)
			add_dialog_choice(0,"Where are we?");
		bmessage = run_dialog(0);
	}
	if(bmessage == 2){
		reset_dialog();
		add_dialog_str(0,"_That's a relief.  I'd hate for you to be flustered and restless so early.  You have a big day ahead of you, you know._",0);
		add_dialog_str(1,"_But I'm sure you're wondering, well...  'What is this place?'  I mean, you are, aren't you?_",0);
		add_dialog_choice(0,"Well, yeah...");
		bmessage = run_dialog(0);
	}

	reset_dialog();
	add_dialog_str(0,"_This place...  I call it the 'Endless Field'.  It's a place of respite.  Say...  Do you know how special you are, for me to show you a place like this?_",0);
	if(party_size() == 1)
		add_dialog_str(1,"He doesn't give me time to answer.",0);
	if(party_size() > 1)
		add_dialog_str(1,"He doesn't give us time to answer.",0);
	add_dialog_str(2,"_This is where I go to think of many things...  I dug myself a small pool to reflect in, and I planted some plants...  You know, I need these things too sometimes._",0);
	add_dialog_str(3,"Is he being sentimental, or merely sarcastic?",0);
	add_dialog_choice(0,"What do you think about?");
	if(party_size() == 1)
		add_dialog_choice(1,"Why should I care?");
	if(party_size() > 1)
		add_dialog_choice(1,"Why should we care?");
	bmessage = run_dialog(1);

	reset_dialog();
	if(bmessage == 1){
		add_dialog_str(0,"_I think about people...  What makes them different than the plants around me?  Or the grass that suffocates under the weight of my body?_",0);
		add_dialog_str(1,"_Well, people fight back very often...  but that can't be it, can it?  I mean, what of those who don't fight back?_",0);
		add_dialog_choice(0,"But they have dignity, surely.");
		add_dialog_choice(1,"Yes...  What of them?  What's your point?");
		bmessage = run_dialog(1);
		if(bmessage == 1){
			set_flag(16,1,0);
			reset_dialog();
			if(party_size() == 1){
				add_dialog_str(0,"_Why?  What do you gain for protecting them?  You are here, risking your life for people whom you've never met.  If you die here, then even worse-- you threw away your everything without the slightest chance of thanks!_",0);
				add_dialog_str(1,"_What are these people to you?  Do you love them?  And if so, why?  Explain yourself!_",0);
			}
			if(party_size() > 1){
				add_dialog_str(0,"_Why?  What do you gain for protecting them?  You are here, risking your lives for people whom you've never met.  If you die here, then even worse-- you threw away your everything without the slightest chance of thanks!_",0);
				add_dialog_str(1,"_What are these people to you?  Do you love them?  And if so, why?  Explain yourselves!_",0);
			}
		}
		else{
			set_flag(16,1,1);
			reset_dialog();
			add_dialog_str(0,"_My point...?  You're perceptive.  My point is no point.  Or, I suppose, if I wanted to present a moral for you, then it would be that protecting people has no point._",0);
			add_dialog_str(1,"_But you are an adventurer to get rich, no?  Are you wagering that Katothen will lavish rewards onto you?  If so, then for me to say that morals exist for weaker men to gain power would be redundant._",0);
		}
	}
	else{
		set_flag(16,1,1);
		if(party_size() == 1){
			add_dialog_str(0,"_Why care?  Oh, but if only you took such insight into all situations:  You would scarcely be here!  If you ask, 'why care', then turn that back onto yourself!_",0);
			add_dialog_str(1,"_You were staring down a high-powered, magical sniper's roost, and yet you charged at me like a sheep shuffling into a barrel of razors!  I have no reason to care for others and thus I do not, but you most clearly do!_",0);
		}
		if(party_size() > 1){
			add_dialog_str(0,"_Why care?  Oh, but if only you took such insight into all situations:  You would scarcely be here!  If you ask, 'why care', then turn that back onto yourselves!_",0);
			add_dialog_str(1,"_You were staring down a high-powered, magical sniper's roost, and yet you charged at me like sheep shuffling into a barrel of razors!  I have no reason to care for others and thus I do not, but you most clearly do!_",0);
		}
	}
	add_dialog_str(2,"There's something wrong with the air.  It's growing heavier and thicker.  It's as oppressive as the air underground.",0);
	add_dialog_choice(0,"There's something seriously wrong here.");
	bmessage = run_dialog(1);

	reset_dialog();
	add_dialog_str(0,"_Don't change the subje-- subje-- subje--_",0);
	add_dialog_str(1,"The Immortal is beginning to twitch.  His subtle movements like turning his head are jerking in the same, erratic pattern.",0);
	add_dialog_str(2," ",0);
	add_dialog_str(3,"_Hey!  You have to snap out of it!_",30);
	add_dialog_choice(0,"Hunter...?");
	bmessage = run_dialog(1);

	rctx = 0;
	while(rctx <= 31){
		rcty = 0;
		while(rcty <= 31){
			if(get_floor(rctx,rcty) == 37)
				set_floor(rctx,rcty,162);
			if(get_floor(rctx,rcty) == 38)
				set_floor(rctx,rcty,163);
			if(get_floor(rctx,rcty) == 39)
				set_floor(rctx,rcty,164);
			if(get_floor(rctx,rcty) == 40)
				set_floor(rctx,rcty,165);
			if(get_floor(rctx,rcty) == 150)
				set_floor(rctx,rcty,154);

			rcty = (rcty + 1);
		}

		rctx = (rctx + 1);
	}
	set_floor(12,16,116);
	set_floor(12,18,204);
	set_floor(13,18,205);
	set_floor(12,17,206);
	set_floor(11,18,207);
	set_floor(12,19,208);
	set_floor(13,17,209);
	set_floor(13,19,210);
	set_floor(11,19,211);
	set_floor(11,17,212);
	set_terrain(15,16,401);
	set_terrain(16,16,401);
	set_terrain(17,16,401);
	set_terrain(14,13,402);
	set_terrain(9,17,443);
	set_terrain(9,21,443);
	set_terrain(11,9,443);
	set_terrain(11,22,443);
	set_terrain(11,24,443);
	set_terrain(12,24,443);
	set_terrain(15,8,443);
	set_terrain(15,12,443);
	set_terrain(16,10,443);
	set_terrain(17,20,443);
	set_terrain(20,11,443);
	set_terrain(24,13,443);
	set_terrain(16,19,444);
	set_terrain(11,14,445);
	set_terrain(14,23,445);
	set_terrain(18,13,445);
	set_terrain(21,17,445);
	set_terrain(8,17,446);
	set_terrain(18,20,446);
	set_terrain(22,8,446);
	set_terrain(22,11,446);

	erase_char(6);
	activate_hidden_group(1);
	relocate_character(7,12,16);
	put_boom_on_space(12,21,3,0);
	force_instant_terrain_redraw();
	run_animation_sound(165);
	pause(8);

	reset_dialog();
	if(party_size() == 1){
		add_dialog_str(0,"_Quickly!  There's no time to explain; this field isn't real!  Your mind is trapped here!  Grab my hand!_",0);
		add_dialog_str(1,"This field...  The colors are all wrong.  The Immortal is perfectly still.  The air is stiflingly thin...  Am I not breathing deeply?",0);
	}
	if(party_size() > 1){
		add_dialog_str(0,"_Quickly!  There's no time to explain; this field isn't real!  Your minds are trapped here!  Grab my hand!_",0);
		add_dialog_str(1,"This field...  The colors are all wrong.  The Immortal is perfectly still.  The air is stiflingly thin...  Are we not breathing deeply?",0);
	}
	add_dialog_str(2,"_Come on!  There's no time to waste!  Grab my hand!_",0);
	add_dialog_choice(0,"Ri...  right!");
	bmessage = run_dialog(1);

	set_flag(15,1,3);

break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
break;

beginstate 10;

	message_dialog("_No!  Don't go that way!  Come to me!  Quickly!_","Hunter is right.  This is not a time to be dawdling.");
	block_entry(1);

break;

beginstate 11;

	move_to_new_town(22,32,40);

break;

